use entropy_bible, clear

merge m:1 translation using data_bible_final, nogenerate keep(3)

/* Keep English varieties */
keep if language=="English"|regexm(language,"nglish")|language=="Middle English"| trans=="djk-x-bible" | trans=="bzj-x-bible" | trans=="bis-x-bible" | trans=="hwc-x-bible-2000" | trans=="jam-x-bible" | trans=="kri-x-bible" | trans=="pcm-x-bible" | trans=="pis-x-bible" | trans=="srm-x-bible" | trans=="pis-x-bible-newworld" | trans=="srn-x-bible-newworld" | trans=="srn-x-bible" | trans=="tpi-x-bible-newworld" | trans=="tpi-x-bible" | trans=="tcs-x-bible" | trans=="gul-x-bible"  

/* we only keep the book of Mark since this is the only available translation for Old English */

keep if book==41


gen group=1
replace group=2 if language=="English"
replace group=3 if language=="Middle English"
replace group=4 if language=="Old English"


          
spearman D_structure D_order     
local corr: di %3.2f r(rho)
local N=r(N)


tw  ///
(scatter D_structure D_order if group==1, jitter(0) msymbol(Th) mcolor(orange) ) ///
(scatter D_structure D_order if group==2, jitter(0) msymbol(Oh) mcolor(blue) ) ///
(scatter D_structure D_order if group==3, jitter(0) msymbol(Sh) mcolor(lime) ) ///
(scatter D_structure D_order if group==4, jitter(0) msymbol(Dh) mcolor(cranberry)) ///
, note("Book: Mark | r{subscript:s}= `corr' | N: `N'") ////
scheme(s2mono) graphregion( color(white)) xscale(nofextend) yscale(nofextend) ///
ylabel(, nogrid format(%3.2f)) xlabel(, nogrid format(%3.2f))  ///
ytitle("Word structure information") xtitle("Word order information") ///
legend(order(4 3 2 1) label(2 "Modern English") label(3 "Middle English") label(4 "Old English") label(1 "English based Creole")) ///
xsize(1) ysize(1)

graph export fig3.png, replace height(10000)
window manage close graph 
exit
